package com.canbot.u05.activity.guide;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.canbot.u05.R;
import com.canbot.u05.activity.BaseActivityNoTitle;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author zmp
 * 导览图片账号
 */
public class GuidePicSetActivity extends BaseActivityNoTitle {

        private String picPath;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_guide_set_pic);
                ButterKnife.bind(this);
                picPath = getIntent().getStringExtra("picPath");
        }

        @OnClick({R.id.pic_no_riv, R.id.pic_go_riv, R.id.main_iv_back})
        public void onViewClicked(View view) {
                switch (view.getId()) {
                        case R.id.pic_no_riv:
                                setResult(RESULT_OK, new Intent().putExtra("picPath", ""));
                                finish();
                                break;
                        case R.id.main_iv_back:
                                finish();
                                break;
                        case R.id.pic_go_riv:
                                Intent picIntent = new Intent(this, GuideChoosePicActivity.class);
                                picIntent.putExtra("picPath", picPath);
                                startForResultActivity(picIntent, 1001);
                                break;
                }
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
                super.onActivityResult(requestCode, resultCode, data);
                if (requestCode == 1001 && resultCode == RESULT_OK) {
                        setResult(RESULT_OK, data);
                        finish();
                }
        }
}